﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Objects;

namespace medder
{
    public partial class ChooseRole : Form
    {
        MedBaseEntities med = new MedBaseEntities();
        public static ObjectSet<User> users;
        User user = new User();

        public ChooseRole(User user)
        {
            InitializeComponent();
            this.user = user;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            short type=0;

            if (Doctor.Checked)
                type = (int)TypeEnum.Doctor;
            if (Registrator.Checked)
                type = (int)TypeEnum.Registrator;
            if (Patient.Checked)
                type = (int)TypeEnum.Patient;

            user.TypeId = type;
            //med.AddToUsers(user);
            //med.SaveChanges();

            this.Hide();

            switch (type)
            {
                case (int)TypeEnum.Doctor:
                    DoctorReg fm1 = new DoctorReg(user);
                    fm1.ShowDialog();
                    break;
                case (int)TypeEnum.Registrator:
                    RegReg fm3 = new RegReg(user);
                    fm3.ShowDialog();
                    
                    break;
                case (int)TypeEnum.Patient:
                    PatReg fm2 = new PatReg(user);
                    fm2.ShowDialog();
                    break;

            }



        }
    }
}
